'user strict'

module.exports = app =>{
    const {STRING,INTEGER,DATE } = app.Sequelize;

    const Role = app.model.define('role',{
        id:{type:INTEGER,primaryKey:true,autoIncrement:true},
        userid:INTEGER,
        coin:INTEGER,
        diamond:INTEGER,
        gems:INTEGER,
        gameid:INTEGER,
        img:STRING(100),
        sex:INTEGER,
        name:STRING(10),
        created_at: DATE,
        updated_at: DATE,
        status:INTEGER
    },{
        freezeTableName: true
    });
    Role.associate = function(){
        app.model.Role.belongsTo(app.model.User,{foreignKey: 'userid', targetKey: 'uid'})
    }
    return Role;
}